class Solution {
public:
    int lengthOfLastWord(string s) {
        int ret = 0;
        for(int i = s.size() - 1; i >= 0; i--)
        {
            if(s[i] == ' ')
                continue;
            while(i >= 0 && s[i] != ' ')
            {
                ret++;
                i--;
            }
            break;
        }
        return ret;
    }
};